
#include <BTaskQueue>

using namespace BWE;

BTaskQueue::BTaskQueue()
{

}
BTaskQueue::~BTaskQueue()
{

}

bool BTaskQueue::push(BTask* task)
{
	_tasksWaiting.push_back(task);
	return true;
}
BTask* BTaskQueue::pop()
{
	BTaskHolder task = _tasksWaiting[0];
	_tasksWaiting.pop_front();
	_tasksExecuting.push_back(task);

	return task.get();
}

void BTaskQueue::finish(BTask* taskFinished)
{
	if(!taskFinished)
		return;

	_tasksExecuting.remove(taskFinished);
}

int BTaskQueue::taskSize()
{
	return _tasksWaiting.size();
}

void BTaskQueue::waitForFinish()
{

}



